package io;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * 缓冲输出流的写出数据时的缓冲区的问题
 */
public class FlushDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("box.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos );

        String line = "沸腾着的,不安着的";
        bos.write(line.getBytes(StandardCharsets.UTF_8));
//        bos.flush();    flush单词    冲水
//        fos.close();
        bos.close();
    }
}
